/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package newkfp.util;

import java.io.IOException;
import javax.faces.context.FacesContext;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpSession;
import newkfp.EmployeeController;

/**
 *
 * @author $alama
 */
public class RestrictPage implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        // TODO Auto-generated method stub
        
        System.out.println("filter");
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
//response.setContentType("text/html;charset=utf-8");
//HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); 
//if(session.getValue("userName")==null||session.getValue("userName").toString().trim().isEmpty()){
//    EmployeeController employeeController=new EmployeeController();
//    employeeController.logOut();
//}
chain.doFilter(request, response); 
    }

    @Override
    public void destroy() {
    }
}
